package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 分类管理
 */
@Api(tags = "分类管理")
@RequestMapping("/user/category")
@RestController("UserCategoryController")
public class CategoryController {

    private static final Logger log = LoggerFactory.getLogger(CategoryController.class);

    @Autowired
    private CategoryService categoryService;

    /**
     * 分类列表查询
     * @param type
     * @return
     */
    @ApiOperation("分类列表查询")
    @GetMapping("/list")
    public Result<List<Category>> list(@RequestParam(value = "type",required = false) Integer type){
        log.info("分类列表查询:{}",type);
        return categoryService.list(type);
    }


}
